package cn.dkdoo.utils.config;

import cn.dkdoo.utils.config.rollbackData.SaveRollbackDataAbstract;
import cn.dkdoo.utils.config.rollbackData.SaveRollbackDataZookper;
import cn.dkdoo.utils.config.transactionalManager.TransactionalManagerAbstract;
import cn.dkdoo.utils.utils.DkdSpringUtils;

/**
 * @author nicky
 * @date 2021/5/11 上午10:20
 */
public class DkdTransactionConfig extends TransactionalManagerAbstract {

    protected SaveRollbackDataAbstract saveRollbackData;

    public DkdTransactionConfig() {
        this.saveRollbackData = DkdSpringUtils.getBeanByClass(SaveRollbackDataAbstract.class);
        this.saveRollbackData = this.saveRollbackData == null ? new SaveRollbackDataZookper() : this.saveRollbackData;
    }

    public DkdTransactionConfig(SaveRollbackDataAbstract saveRollbackData) {
        this.saveRollbackData = saveRollbackData;
    }

    @Override
    public SaveRollbackDataAbstract getSaveRollbackData() {
        return this.saveRollbackData;
    }
}
